package com.lefevre.cms.bean.follow;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 粉丝
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("follower")
@Entity
@Table(name = "follower", indexes = {@Index(name = "follower_1_idx", columnList = "userName,addtime")})
public class Follower implements Serializable {

    private static final long serialVersionUID = -8930887708827331743L;

    /**
     * ID (结构：对方用户Id-关注的用户Id)
     **/
    @Id
    @Column(length = 40)
    @TableId(type = IdType.INPUT)
    protected String id;

    /**
     * 关注的用户名称
     **/
    @Column(length = 30)
    @TableField("userName")
    protected String userName;

    /**
     * 对方的用户名称
     **/
    @Column(length = 30)
    @TableField("friendUserName")
    protected String friendUserName;

    /**
     * 对方呢称
     **/
    @Transient
    @TableField(exist = false)
    protected String friendNickname;

    /**
     * 对方头像路径
     **/
    @Transient
    @TableField(exist = false)
    protected String friendAvatarPath;

    /**
     * 对方头像名称
     **/
    @Transient
    @TableField(exist = false)
    protected String friendAvatarName;

    /**
     * 加入时间
     **/
    @Temporal(TemporalType.TIMESTAMP)
    @TableField("addtime")
    protected Date addtime = new Date();

}
